package PTA_JAVA.JavaB.Javademo10;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        Person p1=new Person();
        p1.setId(Integer.parseInt(sc.next()));
        p1.setName(sc.next());
        p1.setPhoneNumber(sc.next());
        p1.setAddress(sc.next());

        int n = Integer.parseInt(sc.next());
        Person p2=new Person(n);
        Person p3=new Person(Integer.parseInt(sc.next()), sc.next(), sc.next(), sc.next());

        ArrayList<Person> arr = new ArrayList<Person>();
        arr.add(p1);
        arr.add(p2);
        arr.add(p3);
        Collections.sort(arr, new Comparator<Person>() {
            @Override
            public int compare(Person o1, Person o2) {
                return o1.getId()-o2.getId();
            }
        });
        for(Person i:arr){
            System.out.println(i.toString());
        }
    }
}
class Person{
    private int id;
    private String name;
    private String phoneNumber;
    private String address;

    public Person() {
        System.out.println("This is a no-argument constructor");
    }
    public Person(int id) {
        this.id = id;
        System.out.println("This is a single parameter constructor");
    }
    public Person(int id, String name, String phoneNumber, String address) {
        this.id = id;
        this.name = name;
        this.phoneNumber = phoneNumber;
        this.address = address;
        System.out.println("This is a multi-parameter constructor");
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    public String toString() {
        return "Person [" +
                "id=" + id +
                ", name=" + name +
                ", phoneNumber=" + phoneNumber +
                ", address=" + address +
                ']';
    }
}
